use MIME::Lite;
#use MIME::Words qw(encode_mimewords);

&send_alert("P");
&send_alert("F");
sub send_alert {
	($testresult)=@_;
	print "Start send alert Mail\n";
    my $to_address = 'ext-duan.ken@nokia.com';
    my $subject = "Result check Notification";
	my $Fulldata;
    my $Passdata =<<EOF;
<html>
<body bgcolor="green">
<h1>File Check Succeed!</h1>
</body>
</html>
EOF
    my $Faildata =<<EOF;
<html>
<body bgcolor="red">
<h1>File Check Fail!</h1>
</body>
</html>
EOF
if ($testresult eq "P"){
$Fulldata = $Passdata;
} else {
$Fulldata = $Faildata;
}

    my $msg = MIME::Lite->new (
        From => 'mape2emonitoring_SVC_BE@nokia.com',
        To => $to_address,
        Subject => $subject,
        Type     => 'text/html',
        Data     => $Fulldata,
        Encoding => 'base64',
    ) or die "create container failed: $!";

    $msg->attr('content-type.charset' => 'ANSI');
    $msg->send('smtp','smtp.nokia.com',Debug=>0);
	print "Mail sending is finished.\n";
}